<?php
//建立数据库连接
require '../script/mysqlconfig.php';
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
if ($conn->connect_error) {
    die("连接数据库失败: " . $conn->connect_error);
}


//POST没有传递brand参数，表示只是查询
$sql = "SELECT * FROM device_status";
$result = $conn->query($sql);
// 生成表格
if ($result->num_rows > 0) {
    echo "<table border='1' style='border-collapse: collapse;'>";
    echo "<tr><th>设备使用状态</th><th>简介</th></tr>";
    while ($row = $result->fetch_assoc()) {
        echo "<tr><td>" . $row["name"] . "</td><td>" . $row["status_feature"] . "</td></tr>";
    }
    echo "</table>";
} else {
    echo "数据库中没有数据";
}

//关闭数据库连接
$conn->close();
